package com.script

import com.CustomScript
import com.utils.ScriptUtils.script
import org.apache.logging.log4j.kotlin.logger

val projectScriptPath = mutableMapOf(
    "wondergame" to "/Users/boge/WorkSpace/FlashBuilder/WonderGame/script_packWonderGame.lua",
    "lucky" to "/Users/boge/WorkSpace/FlashBuilder/Lucky/script_packLucky.lua"
)

// 通用忽略文件 *.{java,class}
/**
 * @see java.nio.file.FileSystem.getPathMatcher
 */
val ignore = mutableSetOf("**/.{svn,git,DS_Store}", "**/{update,dccTools,layadccout}/**")

println("   completeOnceCheck   ")

script.completeOnceCheck = ::completeOnceCheck

// 执行完成一次文件整理 检查执行的命令
private fun completeOnceCheck() {
    logger.info("completeOnceCheck")
    // 执行替换
    script.runCustomScript(CustomScript::onBeforeReplace)
    script.onReplace?.invoke()
    script.runCustomScript(CustomScript::onAfterReplace)
    // 处理入口文件配置
    script.runCustomScript(CustomScript::onBeforeChangeIndex)
    script.onChangeIndex?.invoke()
    script.runCustomScript(CustomScript::onAfterChangeIndex)
    // 执行压缩
    script.runCustomScript(CustomScript::onBeforeCompress)
    script.onCompress?.invoke()
    script.runCustomScript(CustomScript::onAfterCompress)
}

